/*    REPLICATION NOTES  

*This do-file contains the syntax for all data sets used in the paper. Please be sure to load the according data set when replicating results.

Date:        		28 October 2018
Code Version:		Submission Version
Author:      		Tuxhorn, D'Attoma, and Steinmo
Purpose:     		These files reproduce all results reported in tables and figures found in
					"Trust in Government: Narrowing the Ideological Gap over the Federal Budget" and the supplementary material 
Data Used:   		SSI Survey Data on Budget Preferences
File Names:   		"Replication Do File" (file that estimates the models reported in paper)
Input Files:		"trust_in_government.dta"   
Machine:     		MGF; Macbook
Version:			Stata 14.2
*/

******************************************************************
*************Using TRUST IN GOVERNMENT data set*******************
******************************************************************

clear
set more off
use "trust_in_government.dta", clear



************************************************************************************
*************Replication of Tables and Figures found in Main Text*******************
************************************************************************************

*TABLE 1. MODELS  
eststo clear
fvset base 2 liberal3
qui   nbreg spending_count i.liberal3##c.trust_gov   income education age  female white   democrat republican budget_difficult   , cluster(state)
  eststo m11
qui nbreg revenue_count i.liberal3##c.trust_gov   income education age  female white   democrat republican budget_difficult   , cluster(state)
  eststo m12
estout m1*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N ll bic, labels( "N" "Log\_likelihood" "BIC")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)

*FIGURE 2 GRAPHS 
eststo clear   
fvset base 2 liberal3
 qui nbreg spending_count   i.liberal3##c.trust_gov   income education age  female white   democrat republican budget_difficult   , cluster(state)
 margins, at (trust_gov = (1(1)5)  liberal3 =(1 3))
marginsplot, xtitle("Trust in Government") ytitle("Predicted Number of Spending Items Adjusted") xlab( ,labsize(small)) title("") scheme(s1mono)

fvset base 2 liberal3
 qui nbreg revenue_count   i.liberal3##c.trust_gov   income education age  female white   democrat republican budget_difficult  , cluster(state)
 margins, at (trust_gov = (1(1)5)  liberal3 =(1 3))
marginsplot, xtitle("Trust in Government") ytitle("Predicted Number of Revenue Items Adjusted") xlab( ,labsize(small)) title("") scheme(s1mono)

*TABLE 2. MODELS 
eststo clear

qui   reg healthcare_cuts i.liberal3##c.trust_gov   income education age  female white   democrat republican budget_difficult   , cluster(state)
  eststo m31
qui   reg economic_security_cuts i.liberal3##c.trust_gov   income education age  female white   democrat republican budget_difficult   , cluster(state)
  eststo m32
qui   reg defense_spending_cuts i.liberal3##c.trust_gov   income education age  female white   democrat republican budget_difficult   , cluster(state)
  eststo m33  
estout m3*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N r2 r2_a, labels( "N" "r2" "adj_r2")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)

*TABLE 3. MODELS 
eststo clear

qui   reg tax_all_income i.liberal3##c.trust_gov   income education age  female white   democrat republican budget_difficult   , cluster(state)
  eststo m41
qui   reg tax_high_income i.liberal3##c.trust_gov   income education age  female white   democrat republican budget_difficult   , cluster(state)
  eststo m42
estout m4*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N r2 r2_a, labels( "N" "r2" "adj_r2")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)

*FIGURE 3. GRAPHS 
   
fvset base 2 liberal3
 qui reg healthcare_cuts   i.liberal3##c.trust_gov   income education age  female white democrat republican budget_difficult   , cluster(state)
 margins, at (trust_gov = (1(1)5)  liberal3 =(1 3))
marginsplot, xtitle("Trust in Government") ytitle("Predicted Spending Cuts: Health Care") xlab( ,labsize(small)) title("") scheme(s1mono)
  
fvset base 2 liberal3
 qui reg economic_security_cuts   i.liberal3##c.trust_gov   income education age  female white  democrat republican  budget_difficult  , cluster(state)
 margins, at (trust_gov = (1(1)5)  liberal3 =(1 3))
marginsplot, xtitle("Trust in Government") ytitle("Predicted Spending Cuts: Economic Security") xlab( ,labsize(small)) title("") scheme(s1mono)

  qui reg defense_spending_cuts   i.liberal3##c.trust_gov   income education age  female white  democrat republican  budget_difficult  , cluster(state)
 margins, at (trust_gov = (1(1)5)  liberal3 =(1 3))
marginsplot, xtitle("Trust in Government") ytitle("Predicted Spending Cuts: Defense") xlab( ,labsize(small)) title("") scheme(s1mono)

*FIGURE 4. GRAPHS 
  qui reg tax_all_income   i.liberal3##c.trust_gov   income education age  female white  democrat republican  budget_difficult  , cluster(state)
 margins, at (trust_gov = (1(1)5)  liberal3 =(1 3))
marginsplot, xtitle("Trust in Government") ytitle("Predicted Revenue: Income Tax") xlab( ,labsize(small)) title("") scheme(s1mono)

fvset base 2 liberal3
 qui reg tax_high_income   i.liberal3##c.trust_gov   income education age  female white  democrat republican  budget_difficult  , cluster(state)
 margins, at (trust_gov = (1(1)5)  liberal3 =(1 3))
marginsplot, xtitle("Trust in Government") ytitle("Predicted Revenue:" "Income Tax for High Earners") xlab( ,labsize(small)) title("") scheme(s1mono)




*************************************************************************************************
*************Replication of Tables and Figures found in Supplementary Material*******************
*************************************************************************************************


*TABLE 2 DESCRIPTIVE STATISTICS
summ revenue_count spending_count  healthcare_cuts economic_security_cuts ///
defense_spending_cuts tax_all_income tax_high_income i.liberal3 ///
 trust_gov income education age  female budget_difficult ///
white  democrat republican total_spending_reduced total_revenue education_cuts ///
infrastructure_cuts foreign_diplomatic_cuts corporate_tax_revenue budget_balance


*TABLE 4 MODELS
eststo clear
 qui nbreg spending_count   i.liberal3, cluster(state)
 eststo a11
 qui nbreg spending_count  	i.liberal3 trust_gov, cluster(state)
 eststo a12
qui   nbreg spending_count	i.liberal3##c.trust_gov, cluster(state)
  eststo a13
qui nbreg spending_count 	i.liberal3##c.trust_gov income education age  female white budget_difficult , cluster(state)
  eststo a14
qui nbreg spending_count 	i.liberal3##c.trust_gov income education age  female white   democrat republican budget_difficult   , cluster(state)
  eststo a15  
estout a1*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N ll bic, labels( "N" "Log\_likelihood" "BIC")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)
    
*TABLE 5 MODELS
	
	eststo clear
 qui nbreg revenue_count    i.liberal3, cluster(state)
 eststo a21
 qui nbreg revenue_count    i.liberal3 trust_gov, cluster(state)
 eststo a22
qui   nbreg revenue_count  	i.liberal3##c.trust_gov, cluster(state)
  eststo a23
qui nbreg revenue_count 	i.liberal3##c.trust_gov income education age  female white budget_difficult , cluster(state)
  eststo a24
qui nbreg revenue_count 	i.liberal3##c.trust_gov income education age  female white democrat republican budget_difficult   , cluster(state)
  eststo a25  
estout a2*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N ll bic, labels( "N" "Log\_likelihood" "BIC")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)

*TABLE 6 MODELS

eststo clear    
 qui reg healthcare_cuts   	 i.liberal3, cluster(state)
 eststo a31
 qui reg healthcare_cuts   	i.liberal3 trust_gov, cluster(state)
 eststo a32
qui   reg healthcare_cuts		 i.liberal3##c.trust_gov, cluster(state)
  eststo a33
qui reg healthcare_cuts 		i.liberal3##c.trust_gov income education age  female white budget_difficult , cluster(state)
  eststo a34
qui reg healthcare_cuts 		i.liberal3##c.trust_gov income education age  female white democrat republican budget_difficult   , cluster(state)
  eststo a35  
estout a3*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N r2 r2_a, labels( "N" "r2" "adj_r2")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)

*TABLE 7 MODELS

eststo clear
 qui reg economic_security_cuts    i.liberal3, cluster(state)
 eststo a41
 qui reg economic_security_cuts   i.liberal3 trust_gov, cluster(state)
 eststo a42
qui   reg economic_security_cuts i.liberal3##c.trust_gov, cluster(state)
  eststo a43
qui reg economic_security_cuts i.liberal3##c.trust_gov income education age  female white budget_difficult , cluster(state)
  eststo a44
qui reg economic_security_cuts i.liberal3##c.trust_gov income education age  female white democrat republican budget_difficult   , cluster(state)
  eststo a45  
estout a4*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N r2 r2_a, labels( "N" "r2" "adj_r2")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)
   
*TABLE 8 MODELS
  
eststo clear
 qui reg defense_spending_cuts    i.liberal3, cluster(state)
 eststo a51
 qui reg defense_spending_cuts   i.liberal3 trust_gov, cluster(state)
 eststo a52
qui   reg defense_spending_cuts i.liberal3##c.trust_gov, cluster(state)
  eststo a53
qui reg defense_spending_cuts i.liberal3##c.trust_gov income education age  female white budget_difficult , cluster(state)
  eststo a54
qui reg defense_spending_cuts i.liberal3##c.trust_gov income education age  female white democrat republican budget_difficult   , cluster(state)
  eststo a55  
estout a5*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N r2 r2_a, labels( "N" "r2" "adj_r2")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)
   

*TABLE 9 MODELS

 eststo clear
qui reg tax_all_income    i.liberal3, cluster(state)
 eststo a61
 qui reg tax_all_income   i.liberal3 trust_gov, cluster(state)
 eststo a62
qui   reg tax_all_income i.liberal3##c.trust_gov, cluster(state)
  eststo a63
qui reg tax_all_income i.liberal3##c.trust_gov income education age  female white budget_difficult , cluster(state)
  eststo a64
qui reg tax_all_income i.liberal3##c.trust_gov income education age  female white democrat republican budget_difficult   , cluster(state)
  eststo a65  
estout a6*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N r2 r2_a, labels( "N" "r2" "adj_r2")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)
 
*TABLE 10 MODELS

 eststo clear
qui reg tax_high_income    i.liberal3, cluster(state)
 eststo a71
 qui reg tax_high_income   i.liberal3 trust_gov, cluster(state)
 eststo a72
qui   reg tax_high_income i.liberal3##c.trust_gov, cluster(state)
  eststo a73
qui reg tax_high_income i.liberal3##c.trust_gov income education age  female white budget_difficult , cluster(state)
  eststo a74
qui reg tax_high_income i.liberal3##c.trust_gov income education age  female white democrat republican budget_difficult   , cluster(state)
  eststo a75  
estout a7*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N r2 r2_a, labels( "N" "r2" "adj_r2")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)


*TABLE 11 MODELS

eststo clear
 qui reg total_spending_reduced   i.liberal3, cluster(state)
 eststo a81
 qui reg total_spending_reduced   i.liberal3 trust_gov, cluster(state)
 eststo a82
qui   reg total_spending_reduced i.liberal3##c.trust_gov, cluster(state)
  eststo a83
qui reg total_spending_reduced i.liberal3##c.trust_gov income education age  female white budget_difficult , cluster(state)
  eststo a84
qui reg total_spending_reduced i.liberal3##c.trust_gov income education age  female white democrat republican budget_difficult   , cluster(state)
  eststo a85  
estout a8*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N r2 r2_a, labels( "N" "r2" "adj_r2")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)


*TABLE 12 MODELS

 eststo clear
qui reg total_revenue  i.liberal3, cluster(state)
 eststo a91
 qui reg total_revenue   i.liberal3 trust_gov, cluster(state)
 eststo a92
qui   reg total_revenue i.liberal3##c.trust_gov, cluster(state)
  eststo a93
qui reg total_revenue i.liberal3##c.trust_gov income education age  female white budget_difficult , cluster(state)
  eststo a94
qui reg total_revenue i.liberal3##c.trust_gov income education age  female white democrat republican budget_difficult   , cluster(state)
  eststo a95  
estout a9*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N r2 r2_a, labels( "N" "r2" "adj_r2")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)

*TABLE 13 MODELS

eststo clear 
qui reg education_cuts i.liberal3##c.trust_gov income education age  female white democrat republican budget_difficult   , cluster(state)
 eststo a101
qui reg infrastructure_cuts i.liberal3##c.trust_gov income education age  female white democrat republican budget_difficult   , cluster(state)
 eststo a102
qui reg foreign_diplomatic_cuts i.liberal3##c.trust_gov income education age  female white democrat republican budget_difficult   , cluster(state)
  eststo a103
  qui reg corporate_tax_revenue i.liberal3##c.trust_gov income education age  female white democrat republican budget_difficult   , cluster(state)
  eststo a104
  estout a10*, style(fixed) cells(b(star fmt(%9.3f))se(par)) starlevels(+ 0.10 * 0.05 ** 0.01) stats( N r2 r2_a, labels( "N" "r2" "adj_r2")) varlabels( trust_gov "Trust in Government" conservative_dummy "Conservative" liberal_dummy "Liberal" liberalxtrust "LiberalxTrust" conservativextrust "ConservativexTrust"  income "Income" republican "Republican" democrat "Democrat" education "Education" age "Age"  female "Female" white "White"    budget_difficult "Budget Difficult" ) varwidth(25)
eststo clear 

* FIGURE 1 GRAPH
twoway hist budget_balance, percent scheme(lean2)  bin(100) plotregion(margin(zero))
clear

  
